package com.chlitina.store.modules.inventory.model;

import com.chlitina.store.modules.base.entity.StoreProduct;

public class OutProduct {
	private StoreProduct product;
	private float price;
	private int amount;
	private int realAmount;
	private boolean editing;

	public float getPrice() {
		return price;
	}

	public void setPrice(float price) {
		this.price = price;
	}

	public StoreProduct getProduct() {
		return product;
	}

	public void setProduct(StoreProduct product) {
		this.product = product;
	}

	public int getAmount() {
		return amount;
	}

	public void setAmount(int amount) {
		this.amount = amount;
	}
	
	public boolean canOut(){
		return amount<product.getAmount();
	}
	public boolean out(){
		int left=product.getAmount()-amount;
		if(left>=0){
			product.setAmount(left);
			realAmount=amount;
		}
		return left>=0;
	}
	public OutProduct copy(){
		OutProduct in=new OutProduct();
		in.setAmount(getAmount());
		in.setPrice(getPrice());
		in.setProduct(getProduct());
		return in;
	}

	public int getRealAmount() {
		return realAmount;
	}

	public void setRealAmount(int realAmount) {
		this.realAmount = realAmount;
	}

	public boolean isEditing() {
		return editing;
	}

	public void setEditing(boolean editing) {
		this.editing = editing;
	}
}
